import Vue from 'vue'
import VueRouter from 'vue-router'
import page1router from './modules/page1'
import page2routers from './modules/page2'
import page3routers from './modules/page3'
import shoppingrouters from './modules/shopping'
import sealTableroute from './modules/sealTable'
// import Home from '../views/Home.vue'
//若是通过路由的懒加载的方式则不需要在通过importfang方式在去引入

Vue.use(VueRouter)
//Vue.use说明router是一个插件

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () =>import('../views/Home.vue')
    
  },
  {
      
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
    //这种方式是通过路由的一个懒加载，来进行component的一个匹配
// routes中还有一些属性：
// redirect:'about/page2',
children:[page1router,page2routers,page3routers],
 
  }
]
// routes.push(sealTableroute);
const router = new VueRouter({
  routes
})
// routes.push(shoppingrouters);
// // window.console.log(routes);
const aa = [shoppingrouters,sealTableroute]
// console.log("aa:",aa)

aa.forEach(element => {
  router.addRoute(element)
});


 

 console.log("routes:",routes)
export default router
